﻿import QtQuick 2.0
import QtQuick.Controls         2.12

Button {
    id: mapButton
    hoverEnabled:   true
    /*topPadding:     _verticalPadding
    bottomPadding:  _verticalPadding
    leftPadding:    _horizontalPadding
    rightPadding:   _horizontalPadding*/
    focusPolicy:    Qt.ClickFocus
    implicitWidth:  text.implicitWidth + 20
    implicitHeight: text.implicitHeight + 10
    baselineOffset: text.y + text.baselineOffset

    UiPref { id: uiPref }

    property bool   primary:        false                               ///< primary button for a group of buttons

    readonly property color  _backgroundColorHighlight: uiPref.buttonColorHighlight
    property color  _backgroundColor: enabled? uiPref.buttonColor : uiPref.buttonColorDisabled
    readonly property color  _primaryButtonColor: uiPref.buttonColorPrimary

    property bool   _showHighlight:     pressed | hovered | checked

    /*property int _horizontalPadding:    5
    property int _verticalPadding:      5*/

    Text {
        id:                     text
        anchors.centerIn:       parent
        antialiasing:           true
        text:                   mapButton.text
        font.pointSize:         10
        font.family:            uiPref.fontFamily
        color:                  "black"
    }

    background: Rectangle {
        color: _showHighlight ? _backgroundColorHighlight : (primary? _primaryButtonColor : _backgroundColor)
        border.color: "gray"
        border.width: 1
        radius: 0
    }
}
